<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\index\controller;
use app\index\model\Article as articleList;
class Index extends Common
{
    public function index(){
//

        //TODO 获取首页——轮播
        $article=new articleList();
        $slider=$article->where('show',1)->select();
        $this->assign('slider',$slider);

        //TODO 首页——焦点中心
        $focusList=$article->alias(['article'=>'a','cate'=>'c'])->field('c.desc as cateName,a.*')
            ->join('cate','a.cateid=c.id')->where('cateName','焦点关注')->limit(3)->select();
        $this->assign('focusList',$focusList);

        //TODO 首页——媒体中心
        $newList=$article->alias(['article'=>'a','cate'=>'c'])->field('c.desc as cateName,a.*')
            ->join('cate','a.cateid=c.id')->where('cateName','媒体中心')->limit(4)->select();
        $this->assign('newList',$newList);
        return $this->fetch('index/index');
    }
}